package chapter_six.text67_4.Controller;

import chapter_six.text67_4.bean.Computer;
import chapter_six.text67_4.builder.ComputerBuilder;

/**
 * Data time:2021/9/27 16:03
 * StudentID:2019112118
 * Author:hgw
 * Description:
 */
public class ComputerController {
    //逐步构建复杂产品对象
    public Computer construct(ComputerBuilder cp) {
        Computer computer;
        cp.buildCpu();
        cp.buildHardDisk();
        cp.buildHost();
        cp.buildMemory();
        if (cp.isMonitor()){
            cp.buildMonitor();
        }
        computer =  cp.createComputer();
        return computer;
    }
}
